package com.rk.app.poll.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;

public class NewPoll implements EntryPoint, ResizeHandler {

	private NewPollWidget mainPanel;

	public void onModuleLoad() {
		Window.enableScrolling(false);
		Window.setMargin("0px");
		mainPanel = new NewPollWidget();
		RootPanel.get().add(mainPanel);
		
		
		// Call the window resized handler to get the initial sizes setup. Doing
		// this in a deferred command causes it to occur after all widgets' sizes
		// have been computed by the browser.
		DeferredCommand.addCommand(new Command() {
			public void execute() {
				onWindowResized(Window.getClientWidth(), Window.getClientHeight());
			}
		});

		onWindowResized(Window.getClientWidth(), Window.getClientHeight());
	}

	public void onResize(ResizeEvent event) {
		onWindowResized(event.getWidth(), event.getHeight());

	}

	public void onWindowResized(int width, int height) {
		// Adjust the shortcut panel and detail area to take up the available room
		// in the window.
		// int shortcutHeight = height - mainPanel .getAbsoluteTop() - 8;
		// if (shortcutHeight < 1) {
		// shortcutHeight = 1;
		// }
		// leftPanel.setHeight(shortcutHeight + "px");

		// Give the mail detail widget a chance to resize itself as well.
		// rightPanel.adjustSize(width, height);
	}
}
